package com.hc.server.chat.controller;

import com.hc.server.chat.service.RoomAppService;
import com.hc.server.common.domain.vo.response.ApiResult;
import com.hc.server.chat.domain.vo.request.ContactFriendReq;
import com.hc.server.chat.domain.vo.response.ChatRoomResp;
import com.hc.server.common.utils.RequestHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * Created by wdj on 2024/10/20
 */
@RestController
@RequestMapping("/hc/chat")
@Api(tags = "聊天室相关接口")
@Slf4j
public class ContactController {

    @Autowired
    private RoomAppService roomService;

    @GetMapping("/public/contact/detail/friend")
    @ApiOperation("会话详情(联系人列表发消息用)")
    public ApiResult<ChatRoomResp>getContactDetailByFriend(@Valid ContactFriendReq request){
        Long uid = RequestHolder.get().getUid();
        return ApiResult.success(roomService.getContactDetailByFriend(uid, request.getUid()));
    }
}
